MSVC builds: Update how introspection builds are done
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 8 Sep 2015 06:14:46 +0000 (14:14 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 19 Apr 2016 06:50:25 +0000 (14:50 +0800)
This first adds a common autotools module that can be included by
the Makefile.am's to generate the file lists and the g-ir-scanner/
g-ir-compiler command lines to build the introspection files.

The autotools files for gdk/ and gtk/ are then updated to generate
the full file lists needed to build the introspection files, with
the full command lines for g-ir-scanner and g-ir-compiler as NMake
Makefile modules that can be used to build the introspection files
for Visual Studio builds.

https://bugzilla.gnome.org/show_bug.cgi?id=765195

14 files changed:
build/Makefile.am
build/Makefile.msvc-introspection [new file with mode: 0644]
build/detectenv_msvc.mak [deleted file]
build/gen-file-list-gtk.py [deleted file]
build/gtk-introspection-msvc.mak.in [deleted file]
build/introspection-msvc.mak [deleted file]
build/msvcfiles.py [deleted file]
build/win32/Makefile.am
build/win32/detectenv-msvc.mak [new file with mode: 0644]
build/win32/gtk-introspection-msvc.mak [new file with mode: 0644]
build/win32/introspection-msvc.mak [new file with mode: 0644]
configure.ac
gdk/Makefile.am
gtk/Makefile.am

index 1e6b82587da82a869e748ca5e00bcee308908442..b243d647e9717ce7826a74a9c985678bdba98ad6 100644 (file)
@@ -1,14 +1,5 @@
 include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = \
-       win32
-
-EXTRA_DIST +=  \
-       msvcfiles.py    \
-       gen-file-list-gtk.py    \
-       detectenv_msvc.mak      \
-       introspection-msvc.mak  \
-       gtk-introspection-msvc.mak.in   \
-       gtk-introspection-msvc.mak
+SUBDIRS = win32
 
 -include $(top_srcdir)/git.mk
diff --git a/build/Makefile.msvc-introspection b/build/Makefile.msvc-introspection
new file mode 100644 (file)
index 0000000..6c90964
--- /dev/null
@@ -0,0 +1,125 @@
+# Author: Fan, Chun-wei
+# Common autotools file for constructing the g-ir-scanner and
+# g-ir-compiler command lines for Visual Studio builds.
+
+# This is copied from $(srcroot)/build from the gobject-introspection
+# project, which may be included in projects that support both
+# Visual Studio builds and introspection.
+
+# * Input variables:
+#
+#   MSVC_INTROSPECT_GIRS - List of .gir's that should be built
+#                          in the NMake Makefiles
+#
+# * Simple tutorial
+#
+# Add this to Makefile.am where your library/program is built:
+#   (Either YourLib_1_0_gir_MSVC_LIBS or YourLib_1_0_gir_MSVC_PROGRAM
+#    is required unless --headers-only is specified in
+#    YourLib_1_0_gir__MSVC_SCANNERFLAGS)
+#
+#   include $(top_srcdir)/build/Makefile.msvc-introspection
+#   MSVC_INTROSPECT_GIRS = YourLib-1.0.gir
+#   YourLib_1_0_gir_NAMESPACE = YourLib # This is optional
+#   YourLib_1_0_gir_VERSION = 1.0 # This is optional
+#   YourLib_1_0_gir_MSVC_LIBS = yourlib-1.0
+#   YourLib_1_0_gir_MSVC_FILES = $(libyourlib_1_0_SOURCES)
+#   YourLib_1_0_gir_MSVC_PROGRAM = YourProgram
+#   YourLib_1_0_gir_MSVC_PACKAGES = (Dependent .pc files)
+#   YourLib_1_0_gir_MSVC_INCLUDE_GIRS = (Dependent external .gir's)
+#   YourLiv_1_0_gir_MSVC_EXPORT_PACKAGES = (Packages exported by this .gir)
+
+# Private functions
+
+## Transform the MSVC project filename (no filename extensions) to something which can reference through a variable
+## without automake/make complaining, eg Gtk-2.0 -> Gtk_2_0
+_gir_name=$(subst /,_,$(subst -,_,$(subst .,_,$(1))))
+
+# Namespace and Version is either fetched from the gir filename
+# or the _NAMESPACE/_VERSION variable combo
+_gir_namespace_msvc = $(or $($(_gir_name)_NAMESPACE),$(firstword $(subst -, ,$(notdir $(1)))))
+_gir_version_msvc = $(or $($(_gir_name)_VERSION),$(lastword $(subst -, ,$(1:.gir=))))
+_typelib_basename_msvc = $(_gir_namespace_msvc)'-'$(_gir_version_msvc)
+
+# _PROGRAM is an optional variable which needs its own --program argument
+_gir_program_msvc = $(if $($(_gir_name)_MSVC_PROGRAM),--program=$($(_gir_name)_MSVC_PROGRAM))
+
+# Deduce the sub-folder from $(srcroot) where the sources reside in
+_gir_source_path_raw_msvc:=$(subst $(abs_top_srcdir),,$(abs_srcdir))
+_gir_source_path_msvc=$(subst /,\\,$(_gir_source_path_raw_msvc))
+_gir_source_subdir_int_msvc=$(subst \\\\,\\,\\$(_gir_source_path_msvc)\\)
+_gir_source_subdir_msvc=$(subst \\.\\,\\,$(_gir_source_subdir_int_msvc))
+
+_gir_files_raw_msvc=$(subst /,\\,$($(_gir_name)_MSVC_FILES))
+_gir_files_msvc=$(subst $(srcdir)\\,,$(subst $(builddir)\\,,$(subst $(top_builddir)\\$(_gir_source_path_msvc)\\,\\,$(_gir_files_raw_msvc))))
+
+# Create a list of items for:
+# - Libraries
+# - Packages
+# - GIRs to include
+# - packages to export
+
+_gir_libraries_msvc = $(foreach lib,$($(_gir_name)_MSVC_LIBS),--library=$(lib))
+_gir_packages_msvc = $(foreach pkg,$($(_gir_name)_MSVC_PACKAGES),--pkg=$(pkg))
+_gir_includes_msvc = $(foreach include,$($(_gir_name)_MSVC_INCLUDE_GIRS),--include=$(include))
+_gir_export_packages_msvc = $(foreach pkg,$($(_gir_name)_MSVC_EXPORT_PACKAGES),--pkg-export=$(pkg))
+
+#
+# Create NMake Makefile Sections for Building Introspection files
+# from autotools files
+# $(1) - File Name of the .gir that is to be generated
+#
+
+define gir-nmake-builder
+
+# Basic sanity check, to make sure required variables are set
+$(if $($(_gir_name)_MSVC_FILES),,$(error Need to define $(_gir_name)_MSVC_FILES))
+$(if $(or $(findstring --header-only,$($(_gir_name)_MSVC_SCANNERFLAGS)),
+          $($(_gir_name)_MSVC_LIBS),
+          $($(_gir_name)_MSVC_PROGRAM)),,
+    $(error Need to define $(_gir_name)_MSVC_LIBS or $(_gir_name)_MSVC_PROGRAM))
+
+$(top_builddir)/build/win32/$(_gir_name)_list:
+       for F in $(_gir_files_msvc); do \
+               case $$$$F in \
+               *.c|*.cpp|*.cc|*.cxx|*.h|*.hpp|*.hh|*.hxx) \
+                       echo '..\..'$(_gir_source_subdir_msvc)$$$$F >>$(top_builddir)/build/win32/$(_gir_name)_list \
+                       ;; \
+               esac; \
+       done
+
+$(top_builddir)/build/win32/$(1).msvc.introspect:
+       -$(RM) $(top_builddir)/build/win32/$(1).msvc.introspect
+
+# Assemble the Command to Run g-ir-scanner
+       echo $(1)': '$(_gir_name)'_list '$($(_gir_name)_MSVC_GIR_DEPS)>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  @-echo Generating $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  $$$$(PYTHON) $$$$(G_IR_SCANNER) \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --verbose -no-libtool   \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --namespace='$(_gir_namespace_msvc)'    \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --nsversion='$(_gir_version_msvc)'      \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(_gir_packages_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(_gir_libraries_msvc)'        \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(_gir_program_msvc)'  \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --add-include-path=$$$$(G_IR_INCLUDEDIR)        \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(_gir_includes_msvc)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(_gir_export_packages_msvc)'  \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --cflags-begin  \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$($(_gir_name)_MSVC_CFLAGS)'   \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --cflags-end    \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$($(_gir_name)_MSVC_SCANNERFLAGS)'     \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --filelist='$(_gir_name)'_list  \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  -o $$$$@'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
+
+# Finally Assemble the Command to Compile the generated .gir
+       echo '$(_typelib_basename_msvc).typelib: '$(_typelib_basename_msvc)'.gir'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  @-echo Compiling $$$$@...'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  $$$$(G_IR_COMPILER)     \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  --includedir=. --debug --verbose        \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  '$(1)'  \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '  -o $$$$@'>>$(top_builddir)/build/win32/$(1).msvc.introspect
+       echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
+endef
+
+$(foreach gir,$(MSVC_INTROSPECT_GIRS),$(eval $(call gir-nmake-builder,$(gir))))
diff --git a/build/detectenv_msvc.mak b/build/detectenv_msvc.mak
deleted file mode 100644 (file)
index 020548a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
-# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
-!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
-MSG = ^
-This Makefile is only for Visual Studio 2008 and later.^
-You need to ensure that the Visual Studio Environment is properly set up^
-before running this Makefile.
-!error $(MSG)
-!endif
-
-ERRNUL  = 2>NUL
-_HASH=^#
-
-!if ![echo VCVERSION=_MSC_VER > vercl.x] \
-    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
-    && ![echo PLAT=Win32 >> vercl.x] \
-    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
-    && ![echo PLAT=x64 >> vercl.x] \
-    && ![echo $(_HASH)endif >> vercl.x] \
-    && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
-!include vercl.i
-!if ![echo VCVER= ^\> vercl.vc] \
-    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
-!include vercl.vc
-!endif
-!endif
-!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
-!endif
-
-!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
-VSVER = 9
-!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
-VSVER = 10
-!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
-VSVER = 11
-!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
-VSVER = 12
-!else
-VSVER = 0
-!endif
-
-!if "$(VSVER)" == "0"
-MSG = ^
-This NMake Makefile set supports Visual Studio^
-9 (2008) through 12 (2013).  Your Visual Studio^
-version is not supported.
-!error $(MSG)
-!endif
-
-VALID_CFGSET = FALSE
-!if "$(CFG)" == "release" || "$(CFG)" == "debug"
-VALID_CFGSET = TRUE
-!endif
-
-!if "$(CFG)" == "release"
-CFLAGS_ADD = /MD /O2
-!else
-CFLAGS_ADD = /MDd /Od /Zi
-!endif
-
-!if "$(PLAT)" == "x64"
-LDFLAGS_ARCH = /machine:x64
-!else
-LDFLAGS_ARCH = /machine:x86
-!endif
diff --git a/build/gen-file-list-gtk.py b/build/gen-file-list-gtk.py
deleted file mode 100644 (file)
index d6a8cbc..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/python
-# vim: encoding=utf-8
-# Generate the file lists for processing with g-ir-scanner
-import os
-import sys
-import re
-import string
-import subprocess
-import optparse
-
-from msvcfiles import read_vars_from_AM
-
-def gen_gdk_filelist(srcroot, subdir, dest):
-    vars = read_vars_from_AM(os.path.join(srcroot, subdir, 'Makefile.am'),
-                             vars = {},
-                             conds = {},
-                             filters = ['gdk_h_sources', 'gdk_c_sources'])
-
-    vars['gdk_enums'] = 'gdkenumtypes.c gdkenumtypes.h'
-
-    files = vars['gdk_h_sources'].split() + \
-            vars['gdk_c_sources'].split() + \
-            vars['gdk_enums'].split()
-
-    sources = [i for i in files if (i != 'gdkkeysyms-compat.h')]
-
-    with open(dest, 'w') as d:
-        for i in sources:
-            d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n')
-
-def gen_gdkwin32_filelist(srcroot, subdir, dest):
-    vars = read_vars_from_AM(os.path.join(srcroot, subdir, 'Makefile.am'),
-                             vars = {},
-                             conds = {'HAVE_INTROSPECTION': True,
-                                      'OS_WIN32': True},
-                             filters = ['w32_introspection_files'])
-
-    files = vars['w32_introspection_files'].split()
-
-    with open(dest, 'w') as d:
-        for i in files:
-            d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n')
-
-def gen_gtk_filelist(srcroot, subdir, dest):
-    vars = read_vars_from_AM(os.path.join(srcroot, 'gtk', 'Makefile.am'),
-                             vars = {},
-                             conds = {'USE_WIN32': True,
-                                      'USE_QUARTZ': False,
-                                      'USE_X11': False,
-                                      'USE_EXTERNAL_ICON_CACHE': False},
-                             filters = ['gtkinclude_HEADERS',
-                                        'a11yinclude_HEADERS',
-                                        'deprecatedinclude_HEADERS',
-                                        'gtk_base_c_sources',
-                                        'gtk_clipboard_dnd_c_sources'])
-
-    vars_depr = read_vars_from_AM(os.path.join(srcroot, 'gtk', 'deprecated', 'Makefile.inc'),
-                                  vars = {},
-                                  conds = {},
-                                  filters = ['deprecated_h_sources',
-                                             'deprecated_c_sources'])
-
-    vars_a11y = read_vars_from_AM(os.path.join(srcroot, 'gtk', 'a11y', 'Makefile.inc'),
-                                  vars = {},
-                                  conds = {},
-                                  filters = ['a11y_h_sources',
-                                             'a11y_c_sources'])
-
-    vars['gtk_other_src'] = 'gtkprintoperation-win32.c gtktypebuiltins.h gtktypebuiltins.c'
-
-    files = vars['gtkinclude_HEADERS'].split() + \
-            vars_a11y['a11y_h_sources'].split() + \
-            vars_depr['deprecated_h_sources'].split() + \
-            vars['gtk_base_c_sources'].split() + \
-            vars_a11y['a11y_c_sources'].split() + \
-            vars_depr['deprecated_c_sources'].split() + \
-            vars['gtk_other_src'].split()
-
-    sources = [i for i in files \
-               if not (i.endswith('private.h')) \
-               and i != 'gtktextdisplay.h' \
-               and i != 'gtktextlayout.h' \
-               and i != 'gtkx.h']
-
-    with open(dest, 'w') as d:
-        for i in sources:
-            d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n')
-
-def main(argv):
-    srcroot = '..'
-    subdir_gdk = 'gdk'
-    subdir_gtk = 'gtk'
-
-    gen_gdk_filelist(srcroot, subdir_gdk, 'gdk_list')
-    gen_gdkwin32_filelist(srcroot, subdir_gdk, 'gdkwin32_list')
-    gen_gtk_filelist(srcroot, subdir_gtk, 'gtk_list')
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/build/gtk-introspection-msvc.mak.in b/build/gtk-introspection-msvc.mak.in
deleted file mode 100644 (file)
index ae5ea43..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-# NMake Makefile to build Introspection Files for GTK+
-
-!include detectenv_msvc.mak
-
-APIVERSION = 3.0
-
-CHECK_PACKAGE = gdk-pixbuf-2.0 atk pangocairo gio-2.0
-
-built_install_girs = Gdk-$(APIVERSION).gir GdkWin32-$(APIVERSION).gir Gtk-$(APIVERSION).gir
-built_install_typelibs = Gdk-$(APIVERSION).typelib GdkWin32-$(APIVERSION).typelib Gtk-$(APIVERSION).typelib
-
-!include introspection-msvc.mak
-
-!if "$(BUILD_INTROSPECTION)" == "TRUE"
-all: setgirbuildnev $(built_install_girs) $(built_install_typelibs)
-
-gdk_list gdkwin32_list gtk_list:
-       @-echo Generating Filelist to Introspect for GDK/GTK...
-       $(PYTHON2) gen-file-list-gtk.py
-
-setgirbuildnev:
-       @set CC=$(CC)
-       @set PYTHONPATH=$(BASEDIR)\lib\gobject-introspection
-       @set PATH=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(BASEDIR)\bin;$(PATH)
-       @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
-       @set LIB=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
-
-Gdk-$(APIVERSION).gir: gdk_list
-       @-echo Generating Gdk-$(APIVERSION).gir...
-       $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gdk      \
-       -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \
-       -I$(BASEDIR)\include\pango-1.0 -I$(BASEDIR)\include\atk-1.0     \
-       -I$(BASEDIR)\include\gdk-pixbuf-2.0 -I$(BASEDIR)\include        \
-       --namespace=Gdk --nsversion=3.0 \
-       --include=Gio-2.0 --include=GdkPixbuf-2.0       \
-       --include=Pango-1.0 --include=cairo-1.0 \
-       --no-libtool --library=gdk-3.0  \
-       --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) --add-include-path=.   \
-       --pkg-export gdk-3.0 --warn-all --c-include="gdk/gdk.h" \
-       -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION        \
-       --filelist=gdk_list     -o $@
-
-GdkWin32-$(APIVERSION).gir: gdkwin32_list
-       @-echo Generating GdkWin32-$(APIVERSION).gir...
-       $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gdk      \
-       -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \
-       -I$(BASEDIR)\include\pango-1.0 -I$(BASEDIR)\include\atk-1.0     \
-       -I$(BASEDIR)\include\gdk-pixbuf-2.0 -I$(BASEDIR)\include        \
-       --namespace=GdkWin32 --nsversion=3.0    \
-       --include=Gio-2.0 --include=GdkPixbuf-2.0       \
-       --include=Pango-1.0     --include-uninstalled=./Gdk-$(APIVERSION).gir   \
-       --no-libtool --library=gdk-3.0  \
-       --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) --add-include-path=.   \
-       --pkg-export gdk-win32-3.0 --warn-all --c-include="gdk/gdkwin32.h"      \
-       -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION        \
-       --filelist=gdkwin32_list        -o $@
-
-Gtk-$(APIVERSION).gir: gtk_list
-       $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gtk -I..\gdk     \
-       -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \
-       -I$(BASEDIR)\include\pango-1.0 -I$(BASEDIR)\include\atk-1.0     \
-       -I$(BASEDIR)\include\gdk-pixbuf-2.0 -I$(BASEDIR)\include        \
-       --namespace=Gtk --nsversion=3.0 \
-       --include=Atk-1.0       \
-       --include-uninstalled=./Gdk-$(APIVERSION).gir   \
-       --no-libtool --library=gtk-3.0 --library=gdk-3.0        \
-       --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) --add-include-path=.   \
-       --pkg-export gtk+-3.0 --warn-all --c-include="gtk/gtkx.h"       \
-       -DG_LOG_DOMAIN=\"Gtk\" -DGTK_LIBDIR=\"/dummy/lib\"      \
-       -DGTK_DATADIR=\"/dummy/share\" -DGTK_DATA_PREFIX=\"/dummy\"     \
-       -DGTK_SYSCONFDIR=\"/dummy/etc\" -DGTK_VERSION=\"@GTK_VERSION@\" \
-       -DGTK_BINARY_VERSION=\"3.0.0\" -DGTK_HOST=\"i686-pc-vs$(VSVER)\"        \
-       -DGTK_COMPILATION -DGTK_PRINT_BACKENDS=\"file\" \
-       -DGTK_PRINT_PREVIEW_COMMAND=\"undefined-gtk-print-preview-command\"     \
-       -DGTK_FILE_SYSTEM_ENABLE_UNSUPPORTED -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED     \
-       -DINCLUDE_IM_am_et -DINCLUDE_IM_cedilla -DINCLUDE_IM_cyrillic_translit  \
-       -DINCLUDE_IM_ime -DINCLUDE_IM_inuktitut -DINCLUDE_IM_ipa        \
-       -DINCLUDE_IM_multipress -DINCLUDE_IM_thai -DINCLUDE_IM_ti_er    \
-       -DINCLUDE_IM_ti_et -DINCLUDE_IM_viqr --filelist=gtk_list        \
-       -o $@
-
-$(built_install_typelibs): $(built_install_girs)
-       @-echo Compiling $*.typelib...
-       @-$(G_IR_COMPILER) --includedir=. --debug --verbose $*.gir -o $@
-
-install-introspection: setgirbuildnev $(built_install_girs) $(built_install_typelibs)
-       @-copy *.gir $(G_IR_INCLUDEDIR)
-       @-copy /b *.typelib $(G_IR_TYPELIBDIR)
-
-!else
-all:
-       @-echo $(ERROR_MSG)
-!endif
-
-clean:
-       @-del /f/q *.typelib
-       @-del /f/q *.gir
-       @-del /f/q gtk_list
-       @-del /f/q gdkwin32_list
-       @-del /f/q gdk_list
-       @-del /f/q *.pyc
diff --git a/build/introspection-msvc.mak b/build/introspection-msvc.mak
deleted file mode 100644 (file)
index 55eec45..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# Common Utility NMake Makefile Template
-# Used to Generate Introspection files for various Projects
-
-# Can Override with env vars as needed
-# You will need to have built gobject-introspection for this to work.
-# Change or pass in or set the following to suit your environment
-
-BASEDIR = ..\..\vs$(VSVER)\$(PLAT)
-GIR_SUBDIR = share\gir-1.0
-GIR_TYPELIBDIR = lib\girepository-1.0
-G_IR_SCANNER = $(BASEDIR)\bin\g-ir-scanner
-G_IR_COMPILER = $(BASEDIR)\bin\g-ir-compiler.exe
-G_IR_INCLUDEDIR = $(BASEDIR)\$(GIR_SUBDIR)
-G_IR_TYPELIBDIR = $(BASEDIR)\$(GIR_TYPELIBDIR)
-
-# Note: The PYTHON2 must be a Python 2.6.x or 2.7.x Interpretor!
-# Either having python.exe from Python 2.6.x/2.7.x in your PATH will work
-# or passing in PYTHON2=<full path to your Python 2.6.x/2.7.x interpretor> will do
-
-# This is required, and gobject-introspection needs to be built
-# before this can be successfully run.
-PYTHON2=python
-
-# Don't change anything following this line!
-VALID_PKG_CONFIG_PATH = FALSE
-VALID_GCC_INSTPATH = FALSE
-
-MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
-MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files
-
-ERROR_MSG =
-
-BUILD_INTROSPECTION = TRUE
-
-!if ![pkg-config --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x]     \
-       && ![setlocal]  \
-       && ![set file="pkgconfig.x"]    \
-       && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize]       \
-       && ![del $(ERRNUL) /q/f pkgconfig.x]
-!endif
-
-!include pkgconfig.chksize
-!if "$(PKG_CHECK_SIZE)" == "0"
-VALID_PKG_CONFIG_PATH = TRUE
-!else
-VALID_PKG_CONFIG_PATH = FALSE
-!endif
-
-!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
-!endif
-
-VALID_CFGSET = FALSE
-!if "$(CFG)" == "release" || "$(CFG)" == "debug"
-VALID_CFGSET = TRUE
-!endif
-
-!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
-BUILD_INTROSPECTION = FALSE
-ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
-!endif
-
-!if "$(VALID_CFGSET)" != "TRUE"
-BUILD_INTROSPECTION = FALSE
-ERROR_MSG = $(MSG_INVALID_CFG)
-!endif
diff --git a/build/msvcfiles.py b/build/msvcfiles.py
deleted file mode 100644 (file)
index ca5653d..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-#!/usr/bin/python
-# vim: encoding=utf-8
-#expand *.in files
-import os
-import sys
-import re
-import optparse
-
-def parent_dir(path):
-    if not os.path.isabs(path):
-        path = os.path.abspath(path)
-    if os.path.isfile(path):
-        path = os.path.dirname(path)
-    return os.path.split(path)[0]
-
-def check_output_type (btype):
-    print_bad_type = False
-    output_type = -1
-    if (btype is None):
-        output_type = -1
-        print_bad_type = False
-    elif (btype == "vs9"):
-        output_type = 1
-    elif (btype == "vs10"):
-        output_type = 2
-    elif (btype == "nmake-exe"):
-        output_type = 3
-    else:
-        output_type = -1
-        print_bad_type = True
-    if (output_type == -1):
-        if (print_bad_type is True):
-            print ("The entered output build file type '%s' is not valid" % btype)
-        else:
-            print ("Output build file type is not specified.\nUse -t <type> to specify the output build file type.")
-        print ("Valid output build file types are: nmake-exe, vs9 , vs10")
-    return output_type
-
-def read_vars_from_AM(path, vars = {}, conds = {}, filters = None):
-    '''
-    path: path to the Makefile.am
-    vars: predefined variables
-    conds: condition variables for Makefile
-    filters: if None, all variables defined are returned,
-             otherwise, it is a list contains that variables should be returned
-    '''
-    cur_vars = vars.copy()
-    RE_AM_VAR_REF = re.compile(r'\$\((\w+?)\)')
-    RE_AM_VAR = re.compile(r'^\s*(\w+)\s*=(.*)$')
-    RE_AM_INCLUDE = re.compile(r'^\s*include\s+(\w+)')
-    RE_AM_VAR_ADD = re.compile(r'^\s*(\w+)\s*\+=(.*)$')
-    RE_AM_CONTINUING = re.compile(r'\\\s*$')
-    RE_AM_IF = re.compile(r'^\s*if\s+(\w+)')
-    RE_AM_IFNOT = re.compile(r'^\s*if\s!+(\w+)')
-    RE_AM_ELSE = re.compile(r'^\s*else')
-    RE_AM_ENDIF = re.compile(r'^\s*endif')
-    def am_eval(cont):
-        return RE_AM_VAR_REF.sub(lambda x: cur_vars.get(x.group(1), ''), cont)
-    with open(path, 'r') as f:
-        contents = f.readlines()
-    #combine continuing lines
-    i = 0
-    ncont = []
-    while i < len(contents):
-        line = contents[i]
-        if RE_AM_CONTINUING.search(line):
-            line = RE_AM_CONTINUING.sub('', line)
-            j = i + 1
-            while j < len(contents) and RE_AM_CONTINUING.search(contents[j]):
-                line += RE_AM_CONTINUING.sub('', contents[j])
-                j += 1
-            else:
-                if j < len(contents):
-                    line += contents[j]
-            i = j
-        else:
-            i += 1
-        ncont.append(line)
-
-    #include, var define, var evaluation
-    i = -1
-    skip = False
-    oldskip = []
-    while i < len(ncont) - 1:
-        i += 1
-        line = ncont[i]
-        mo = RE_AM_IF.search(line)
-        if mo:
-            oldskip.append(skip)
-            skip = False if mo.group(1) in conds and conds[mo.group(1)] \
-                         else True
-            continue
-        mo = RE_AM_IFNOT.search(line)
-        if mo:
-            oldskip.append(skip)
-            skip = False if mo.group(1) not in conds and conds[mo.group(1)] \
-                         else True
-            continue
-        mo = RE_AM_ELSE.search(line)
-        if mo:
-            skip = not skip
-            continue
-        mo = RE_AM_ENDIF.search(line)
-        if mo:
-            if oldskip:
-                skip = oldskip.pop()
-            continue
-        if not skip:
-            mo = RE_AM_INCLUDE.search(line)
-            if mo:
-                cur_vars.update(read_vars_from_AM(am_eval(mo.group(1)), cur_vars, conds, None))
-                continue
-            mo = RE_AM_VAR.search(line)
-            if mo:
-                cur_vars[mo.group(1)] = am_eval(mo.group(2).strip())
-                continue
-            mo = RE_AM_VAR_ADD.search(line)
-            if mo:
-                try:
-                    cur_vars[mo.group(1)] += ' '
-                except KeyError:
-                    cur_vars[mo.group(1)] = ''
-                cur_vars[mo.group(1)] += am_eval(mo.group(2).strip())
-                continue
-
-    #filter:
-    if filters != None:
-        ret = {}
-        for i in filters:
-            ret[i] = cur_vars.get(i, '')
-        return ret
-    else:
-        return cur_vars
-
-def process_include(src, dest, includes):
-    RE_INCLUDE = re.compile(r'^\s*#include\s+"(.*)"')
-    with open(src, 'r') as s:
-        with open(dest, 'w') as d:
-            for i in s:
-                mo = RE_INCLUDE.search(i)
-                if mo:
-                    target = ''
-                    for j in includes:
-                        #print "searching in ", j
-                        if mo.group(1) in os.listdir(j):
-                            target = os.path.join(j, mo.group(1))
-                            break
-                    if not target:
-                        raise Exception("Couldn't find include file %s" % mo.group(1))
-                    else:
-                        with open(target, 'r') as t:
-                            for inc in t.readlines():
-                                d.write(inc)
-                else:
-                    d.write(i)
-
-#Generate the source files listing that is used
-def generate_src_list (srcroot, srcdir, filters_src, filter_conds, filter_c, mk_am_file):
-    mkfile = ''
-    if mk_am_file is None or mk_am_file == '':
-        mkfile = 'Makefile.am'
-    else:
-        mkfile = mk_am_file
-    vars = read_vars_from_AM(os.path.join(srcdir, mkfile),
-                             vars = {'top_srcdir': srcroot},
-                             conds = filter_conds,
-                             filters = filters_src)
-    files = []
-    for src_filters_item in filters_src:
-        files += vars[src_filters_item].split()
-    if filter_c is True:
-        sources = [i for i in files if i.endswith('.c') ]
-        return sources
-    else:
-        return files
-
-# Generate the Visual Studio 2008 Project Files from the templates
-def gen_vs9_project (projname, srcroot, srcdir_name, sources_list):
-    vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
-    with open (os.path.join (vs_file_list_dir,
-              projname + '.sourcefiles'), 'w') as vs9srclist:
-        for i in sources_list:
-            vs9srclist.write ('\t\t\t<File RelativePath="..\\..\\..\\' + srcdir_name + '\\' + i.replace('/', '\\') + '" />\n')
-
-    process_include (os.path.join(srcroot, 'build', 'win32', 'vs9', projname + '.vcprojin'),
-                     os.path.join(srcroot, 'build', 'win32', 'vs9', projname + '.vcproj'),
-                     includes = [vs_file_list_dir])
-
-    os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.sourcefiles'))
-
-# Generate the Visual Studio 2010 Project Files from the templates
-def gen_vs10_project (projname, srcroot, srcdir_name, sources_list):
-    vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
-    with open (os.path.join (vs_file_list_dir,
-              projname + '.vs10.sourcefiles'), 'w') as vs10srclist:
-        for j in sources_list:
-            vs10srclist.write ('    <ClCompile Include="..\\..\\..\\' + srcdir_name + '\\' + j.replace('/', '\\') + '" />\n')
-
-    with open (os.path.join (vs_file_list_dir,
-              projname + '.vs10.sourcefiles.filters'), 'w') as vs10srclist_filter:
-        for k in sources_list:
-             vs10srclist_filter.write ('    <ClCompile Include="..\\..\\..\\' + srcdir_name + '\\' + k.replace('/', '\\') + '"><Filter>Source Files</Filter></ClCompile>\n')
-
-    process_include (os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxprojin'),
-                     os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj'),
-                     includes = [vs_file_list_dir])
-    process_include (os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj.filtersin'),
-                     os.path.join(srcroot, 'build', 'win32', 'vs10', projname + '.vcxproj.filters'),
-                     includes = [vs_file_list_dir])
-
-    os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.vs10.sourcefiles'))
-    os.unlink(os.path.join(srcroot, 'build', 'win32', projname + '.vs10.sourcefiles.filters'))
-
-def gen_vs_inst_list (projname, srcroot, srcdirs, inst_lists, destdir_names, isVS9):
-    vs_file_list_dir = os.path.join (srcroot, 'build', 'win32')
-    vsver = ''
-    vsprops_line_ending = ''
-    vsprops_file_ext = ''
-    if isVS9 is True:
-        vsver = '9'
-        vsprops_line_ending = '&#x0D;&#x0A;\n'
-        vsprops_file_ext = '.vsprops'
-    else:
-        vsver = '10'
-        vsprops_line_ending = '\n\n'
-        vsprops_file_ext = '.props'
-
-    with open (os.path.join (vs_file_list_dir,
-              projname + '.vs' + vsver + 'instfiles'), 'w') as vsinstlist:
-
-        for file_list, srcdir, dir_name in zip (inst_lists, srcdirs, destdir_names):
-            for i in file_list:
-                vsinstlist.write ('copy ..\\..\\..\\' +
-                                  srcdir + '\\' +
-                                  i.replace ('/', '\\') +
-                                  ' $(CopyDir)\\' +
-                                  dir_name +
-                                  vsprops_line_ending)
-    process_include (os.path.join(srcroot, 'build', 'win32', 'vs' + vsver, projname + '-install' + vsprops_file_ext + 'in'),
-                     os.path.join(srcroot, 'build', 'win32', 'vs' + vsver, projname + '-install' + vsprops_file_ext),
-                     includes = [vs_file_list_dir])
-
-    os.unlink(os.path.join (vs_file_list_dir, projname + '.vs' + vsver + 'instfiles'))
-
-def generate_nmake_makefiles(srcroot, srcdir, base_name, makefile_name, progs_list):
-    file_list_dir = os.path.join (srcroot, 'build', 'win32')
-
-    with open (os.path.join (file_list_dir,
-              base_name + '_progs'), 'w') as proglist:
-        for i in progs_list:
-            proglist.write ('\t' + i + '$(EXEEXT)\t\\\n')
-
-
-    process_include (os.path.join(srcdir, makefile_name + 'in'),
-                    os.path.join(srcdir, makefile_name),
-                    includes = [file_list_dir])
-
-    os.unlink(os.path.join (file_list_dir, base_name + '_progs'))
-
index 6563fb34da1eaf12a445b45ba35b6ff12758174a..138501846cd40578da8a464ea9066d7f19c2db70 100644 (file)
@@ -1,5 +1,31 @@
 include $(top_srcdir)/Makefile.decl
 
+if HAVE_INTROSPECTION
+GENERATED_ITEMS = \
+       introspection.body.mak  \
+       Gdk_3_0_gir_list                \
+       GdkWin32_3_0_gir_list   \
+       Gtk_3_0_gir_list
+
+MSVC_INTROSPECTION_INTERMEDIATE_FILES = Gdk-3.0.gir.msvc.introspect GdkWin32-3.0.gir.msvc.introspect Gtk-3.0.gir.msvc.introspect
+
+introspection.body.mak: $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
+       -$(RM) introspection.body.mak
+       for F in `ls *.msvc.introspect`; do \
+               case $$F in \
+                       *)      cat $(top_builddir)/build/win32/$$F >>introspection.body.mak \
+                       ;; \
+               esac; \
+       done
+       $(RM) $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
+
+DISTCLEANFILES = $(GENERATED_ITEMS)
+
+else
+GENERATED_ITEMS =
+DISTCLEANFILES =
+endif
+
 SUBDIRS =      \
        vs9     \
        vs10    \
@@ -7,6 +33,11 @@ SUBDIRS =     \
        vs12    \
        vs14
 
-EXTRA_DIST += replace.py
+EXTRA_DIST +=  \
+       detectenv-msvc.mak              \
+       introspection-msvc.mak          \
+       gtk-introspection-msvc.mak      \
+       replace.py                      \
+       $(GENERATED_ITEMS)
 
 -include $(top_srcdir)/git.mk
diff --git a/build/win32/detectenv-msvc.mak b/build/win32/detectenv-msvc.mak
new file mode 100644 (file)
index 0000000..61f979d
--- /dev/null
@@ -0,0 +1,76 @@
+# Common NMake Makefile module for checking the build environment
+# This can be copied from $(glib_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC, and can be used
+# for building test programs as well.
+
+# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
+# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
+!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
+MSG = ^
+This Makefile is only for Visual Studio 2008 and later.^
+You need to ensure that the Visual Studio Environment is properly set up^
+before running this Makefile.
+!error $(MSG)
+!endif
+
+ERRNUL  = 2>NUL
+_HASH=^#
+
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+    && ![echo PLAT=Win32 >> vercl.x] \
+    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+    && ![echo PLAT=x64 >> vercl.x] \
+    && ![echo $(_HASH)endif >> vercl.x] \
+    && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
+VSVER = 9
+!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
+VSVER = 10
+!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
+VSVER = 11
+!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
+VSVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+VSVER = 14
+!else
+VSVER = 0
+!endif
+
+!if "$(VSVER)" == "0"
+MSG = ^
+This NMake Makefile set supports Visual Studio^
+9 (2008) through 14 (2015).  Your Visual Studio^
+version is not supported.
+!error $(MSG)
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+# We want debugging symbols logged for all builds,
+# using .pdb files for release builds
+CFLAGS_BASE = /Zi
+
+!if "$(CFG)" == "release" || "$(CFG)" == "Release"
+CFLAGS_ADD = /MD /O2 $(CFLAGS_BASE)
+!else
+CFLAGS_ADD = /MDd /Od $(CFLAGS_BASE)
+!endif
+
+!if "$(PLAT)" == "x64"
+LDFLAGS_ARCH = /machine:x64
+!else
+LDFLAGS_ARCH = /machine:x86
+!endif
diff --git a/build/win32/gtk-introspection-msvc.mak b/build/win32/gtk-introspection-msvc.mak
new file mode 100644 (file)
index 0000000..2149650
--- /dev/null
@@ -0,0 +1,43 @@
+# NMake Makefile to build Introspection Files for GTK+
+
+!include detectenv-msvc.mak
+
+APIVERSION = 3.0
+
+CHECK_PACKAGE = gdk-pixbuf-2.0 atk pangocairo gio-2.0
+
+built_install_girs = Gdk-$(APIVERSION).gir GdkWin32-$(APIVERSION).gir Gtk-$(APIVERSION).gir
+built_install_typelibs = Gdk-$(APIVERSION).typelib GdkWin32-$(APIVERSION).typelib Gtk-$(APIVERSION).typelib
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+
+!if "$(PLAT)" == "x64"
+AT_PLAT=x86_64
+!else
+AT_PLAT=i686
+!endif
+
+all: setgirbuildenv $(built_install_girs) $(built_install_typelibs)
+
+setgirbuildenv:
+       @set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
+       @set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
+       @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+       @set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+
+!include introspection.body.mak
+
+install-introspection: all 
+       @-copy *.gir $(G_IR_INCLUDEDIR)
+       @-copy /b *.typelib $(G_IR_TYPELIBDIR)
+
+!else
+all:
+       @-echo $(ERROR_MSG)
+!endif
+
+clean:
+       @-del /f/q *.typelib
+       @-del /f/q *.gir
diff --git a/build/win32/introspection-msvc.mak b/build/win32/introspection-msvc.mak
new file mode 100644 (file)
index 0000000..8739844
--- /dev/null
@@ -0,0 +1,94 @@
+# Common NMake Makefile module for checking the build environment is sane
+# for building introspection files under MSVC/NMake.
+# This can be copied from $(gi_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC.
+
+# Can override with env vars as needed
+# You will need to have built gobject-introspection for this to work.
+# Change or pass in or set the following to suit your environment
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+!if ![setlocal]                && \
+    ![set PFX=$(PREFIX)]       && \
+    ![for %P in (%PFX%) do @echo PREFIX_FULL=%~dpnfP > pfx.x]
+!endif
+!include pfx.x
+
+!if "$(PKG_CONFIG_PATH)" == ""
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig
+!else
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig;$(PKG_CONFIG_PATH)
+!endif
+
+!if ![del $(ERRNUL) /q/f pfx.x]
+!endif
+
+# Note: The PYTHON must be the Python release series that was used to build
+# the GObject-introspection scanner Python module!
+# Either having python.exe your PATH will work or passing in
+# PYTHON=<full path to your Python interpretor> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+!if "$(PYTHON)" == ""
+PYTHON=python
+!endif
+
+# Path to the pkg-config tool, if not already in the PATH
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG=pkg-config
+!endif
+
+# Don't change anything following this line!
+
+GIR_SUBDIR = share\gir-1.0
+GIR_TYPELIBDIR = lib\girepository-1.0
+G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner
+G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR)
+
+VALID_PKG_CONFIG_PATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files
+
+ERROR_MSG =
+
+BUILD_INTROSPECTION = TRUE
+
+!if ![set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)]  \
+       && ![$(PKG_CONFIG) --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x]    \
+       && ![setlocal]  \
+       && ![set file="pkgconfig.x"]    \
+       && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize]       \
+       && ![del $(ERRNUL) /q/f pkgconfig.x]
+!endif
+
+!include pkgconfig.chksize
+!if "$(PKG_CHECK_SIZE)" == "0"
+VALID_PKG_CONFIG_PATH = TRUE
+!else
+VALID_PKG_CONFIG_PATH = FALSE
+!endif
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
+!endif
+
+!if "$(VALID_CFGSET)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_CFG)
+!endif
index c788ee4dfd4e5e1968e28358c61c6cc640e6a600..f200561cdf91793c85903259984096d649902404 100644 (file)
@@ -1920,7 +1920,6 @@ docs/reference/libgail-util/Makefile
 docs/reference/libgail-util/version.xml
 docs/tools/Makefile
 build/Makefile
-build/gtk-introspection-msvc.mak
 build/win32/Makefile
 build/win32/vs9/Makefile
 build/win32/vs9/gtk3-version-paths.vsprops
index b2d0c5c25e5d4d25661f784f6a45d931ad744f7c..74e321f351555bdeb40e3cdd382f48ff9d85792b 100644 (file)
@@ -33,9 +33,13 @@ EXTRA_DIST +=                        \
        gdkenumtypes.h.template \
        gdkversionmacros.h.in
 
-AM_CPPFLAGS =                          \
+GDK_CFLAGS_DEFINES =   \
        -DG_LOG_DOMAIN=\"Gdk\"          \
-       -DGDK_COMPILATION               \
+       -DGDK_COMPILATION
+
+
+AM_CPPFLAGS =                          \
+       $(GDK_CFLAGS_DEFINES)           \
        -I$(top_builddir)               \
        -I$(top_builddir)/gdk           \
        -I$(top_srcdir)                 \
@@ -302,7 +306,6 @@ INTROSPECTION_GIRS += GdkX11-3.0.gir
 
 endif # USE_X11
 
-if OS_WIN32
 w32_introspection_files =              \
        win32/gdkcursor-win32.c         \
        win32/gdkdevicemanager-win32.c  \
@@ -333,7 +336,7 @@ w32_introspection_files =           \
        win32/gdkwin32window.h          \
        win32/gdkwindow-win32.c
 
-
+if OS_WIN32
 GdkWin32-3.0.gir: libgdk-3.la Gdk-3.0.gir Makefile
 GdkWin32_3_0_gir_SCANNERFLAGS = \
        --identifier-prefix=Gdk         \
@@ -455,9 +458,46 @@ gdk_3_HEADERS_EXCLUDES = dummy
 
 include $(top_srcdir)/build/Makefile.msvcproj
 
+if HAVE_INTROSPECTION
+# Introspection Items for MSVC
+MSVC_INTROSPECT_GIRS = Gdk-3.0.gir GdkWin32-3.0.gir
+
+BASE_MSVC_GIR_CFLAGS =                 \
+       $(GDK_CFLAGS_DEFINES)           \
+       -I../.. -I../../gdk -I.../../gdk/win32
+
+INTROSPECTION_INTERMEDIATE_ITEMS = \
+       $(top_builddir)/build/win32/Gdk-3.0.gir.msvc.introspect \
+       $(top_builddir)/build/win32/Gdk_3_0_gir_list                    \
+       $(top_builddir)/build/win32/GdkWin32-3.0.gir.msvc.introspect    \
+       $(top_builddir)/build/win32/GdkWin32_3_0_gir_list
+
+Gdk_3_0_gir_MSVC_FILES = $(introspection_files)
+Gdk_3_0_gir_MSVC_EXPORT_PACKAGES = $(Gdk_3_0_gir_EXPORT_PACKAGES)
+Gdk_3_0_gir_MSVC_INCLUDE_GIRS = $(Gdk_3_0_gir_INCLUDES)
+Gdk_3_0_gir_MSVC_LIBS = gdk-3.0
+Gdk_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
+Gdk_3_0_gir_MSVC_SCANNERFLAGS = $(Gdk_3_0_gir_SCANNERFLAGS)
+
+GdkWin32_3_0_gir_MSVC_FILES = $(w32_introspection_files)
+GdkWin32_3_0_gir_MSVC_INCLUDE_GIRS = $(GdkWin32_3_0_gir_INCLUDES)
+GdkWin32_3_0_gir_MSVC_LIBS = $(Gdk_3_0_gir_MSVC_LIBS)
+GdkWin32_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
+GdkWin32_3_0_gir_MSVC_SCANNERFLAGS =   \
+       --identifier-prefix=Gdk         \
+       --c-include="gdk/gdkwin32.h"    \
+       --include-uninstalled=./Gdk-3.0.gir
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+
+else
+INTROSPECTION_INTERMEDIATE_ITEMS =
+endif
+
 dist-hook: \
        $(top_builddir)/build/win32/vs9/gdk-3.vcproj    \
-       $(top_builddir)/build/win32/vs9/gdk-3.headers
+       $(top_builddir)/build/win32/vs9/gdk-3.headers   \
+       $(INTROSPECTION_INTERMEDIATE_ITEMS)
 
 DISTCLEANFILES = gdkconfig.h stamp-gc-h
 
index c9f34307301516f6e401899a834bd48679ea798f..ba098d77d94469d4ac978a9d96f582cd692a0f20 100644 (file)
@@ -2,18 +2,24 @@ AUTOMAKE_OPTIONS = subdir-objects
 
 include $(top_srcdir)/Makefile.decl
 
-AM_CPPFLAGS =                                          \
+GTK_BASE_CFLAGS_DEFINES =                              \
        -DG_LOG_DOMAIN=\"Gtk\"                          \
+       -DGTK_VERSION=\"$(GTK_VERSION)\"                \
+       -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\"  \
+       -DGTK_COMPILATION                               \
+       -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED
+
+GTK_PLAT_CFLAGS_DEFINES =                              \
        -DGTK_LIBDIR=\"$(libdir)\"                      \
        -DGTK_DATADIR=\"$(datadir)\"                    \
        -DGTK_DATA_PREFIX=\"$(prefix)\"                 \
        -DGTK_SYSCONFDIR=\"$(sysconfdir)\"              \
-       -DGTK_VERSION=\"$(GTK_VERSION)\"                \
-       -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\"  \
        -DGTK_HOST=\"$(host)\"                          \
-       -DGTK_COMPILATION                               \
-       -DGTK_PRINT_BACKENDS=\"$(GTK_PRINT_BACKENDS)\"  \
-       -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED          \
+       -DGTK_PRINT_BACKENDS=\"$(GTK_PRINT_BACKENDS)\"
+
+AM_CPPFLAGS =                                          \
+       $(GTK_BASE_CFLAGS_DEFINES)                      \
+       $(GTK_PLAT_CFLAGS_DEFINES)                      \
        -DX11_DATA_PREFIX=\"$(X11_PREFIX)\"             \
        -I$(top_builddir)                               \
        -I$(top_builddir)/gtk                           \
@@ -1434,9 +1440,60 @@ gtk_3_HEADERS_EXCLUDES = dummy
 
 include $(top_srcdir)/build/Makefile.msvcproj
 
+if HAVE_INTROSPECTION
+# Introspection Items for MSVC
+MSVC_INTROSPECT_GIRS = Gtk-3.0.gir
+
+GTK_MSVC_GIR_CFLAGS =                                          \
+       $(GTK_BASE_CFLAGS_DEFINES)                              \
+       -DGTK_LIBDIR=\\\"/dummy/lib\\\"                         \
+       -DGTK_DATADIR=\\\"/dummy/share\\\"                      \
+       -DGTK_DATA_PREFIX=\\\"/dummy\\\"                        \
+       -DGTK_SYSCONFDIR=\\\"/dummy/etc\\\"                     \
+       -DGTK_HOST=\\\"'$$$$(AT_PLAT)'-pc-vs'$$$$(VSVER)'\\\"   \
+       -DGTK_PRINT_BACKENDS=\\\"file\\\"                       \
+       -DINCLUDE_IM_am_et                      \
+       -DINCLUDE_IM_cedilla                    \
+       -DINCLUDE_IM_cyrillic_translit          \
+       -DINCLUDE_IM_ime                        \
+       -DINCLUDE_IM_inuktitu                   \
+       -DINCLUDE_IM_ipa                        \
+       -DINCLUDE_IM_multipress                 \
+       -DINCLUDE_IM_thai                       \
+       -DINCLUDE_IM_ti_er                      \
+       -DINCLUDE_IM_ti_et                      \
+       -DINCLUDE_IM_viqr                       \
+       -DGTK_TEXT_USE_INTERNAL_UNSUPPORTED_API \
+       -I../.. -I../../gtk -I../../gdk
+
+INTROSPECTION_INTERMEDIATE_ITEMS = \
+       $(top_builddir)/build/win32/Gtk-3.0.gir.msvc.introspect         \
+       $(top_builddir)/build/win32/Gtk_3_0_gir_list
+
+Gtk_3_0_gir_MSVC_FILES =               \
+       $(introspected_pub_headers)     \
+       $(gtk_base_c_sources)           \
+       $(gtk_os_win32_c_sources)       \
+       gtktypebuiltins.h               \
+       gtktypebuiltins.c
+
+Gtk_3_0_gir_MSVC_EXPORT_PACKAGES = $(Gtk_3_0_gir_EXPORT_PACKAGES)
+Gtk_3_0_gir_MSVC_INCLUDE_GIRS = Atk-1.0
+Gtk_3_0_gir_MSVC_LIBS = gtk-3.0 gdk-3.0
+Gtk_3_0_gir_MSVC_CFLAGS = $(GTK_MSVC_GIR_CFLAGS)
+Gtk_3_0_gir_MSVC_SCANNERFLAGS = --warn-all --add-include-path=. --include-uninstalled=./Gdk-3.0.gir
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+
+else
+INTROSPECTION_INTERMEDIATE_ITEMS =
+
+endif
+
 dist-hook: \
        $(top_builddir)/build/win32/vs9/gtk-3.vcproj    \
-       $(top_builddir)/build/win32/vs9/gtk-3.headers
+       $(top_builddir)/build/win32/vs9/gtk-3.headers   \
+       $(INTROSPECTION_INTERMEDIATE_ITEMS)
 
 # Install a RC file for the default GTK+ theme, and key themes
 install-data-local: install-ms-lib install-def-file install-mac-key-theme
@@ -1457,8 +1514,10 @@ distclean-local:
        fi
 
 if HAVE_INTROSPECTION
+introspected_pub_headers = $(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS))
+
 introspection_files = \
-    $(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
+    $(introspected_pub_headers) \
     $(filter-out %win32.c, $(gtk_base_c_sources)) \
     gtkprintoperation-unix.c \
     gtktypebuiltins.h \